package de.au.fi.calc.criteria;

public abstract class Criteria {

	protected Double positiveLimit;

	protected Double negativLimit;

	protected Double value;
	
	protected String label = "notSet!!!";

	protected Integer result;

	public Criteria(String label, Double positiveLimit, Double negativLimit, Double value) {
		this.label = label;
		this.positiveLimit = positiveLimit;
		this.negativLimit = negativLimit;
		this.value = value;
	}
	
	public Criteria(String label) {
		this.label = label;
	}


	protected int calculate() {
		if(value==null)return 0;
		if (value > positiveLimit)
			return 1;
		if (value < negativLimit)
			return -1;
		return 0;
	}

	public String getLabel() {
		return label;
	}

	public Double getPositiveLimit() {
		return positiveLimit;
	}

	public Double getNegativLimit() {
		return negativLimit;
	}

	public Double getValue() {
		return value;
	}

	public Integer getResult() {
		if(result==null)
			result=calculate();
		return result;
	}
}
